package com.changgou.controller;

import com.changgou.service.ItemInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: hushengjin
 */
@RestController
@RequestMapping("/itemInfo")
@CrossOrigin
public class ItemInfoController {

    @Autowired
    private ItemInfoService itemInfoService;

    @PostMapping("/decrCount")
    public String decrCount(@RequestParam(value = "id") int id, @RequestParam(value = "count") int count) {
        //库存递减
        boolean b = itemInfoService.decrCount(id, count);
        if (b) {
            return "success";
        }
        return "fail";
    }

}
